﻿using System.Windows.Forms;
using System.Drawing;
using System.Collections.Generic;

namespace HurlBat.XEdit2D
{
    public partial class AnimationNode : Node
    {
        List<ImageNode> inputs = new List<ImageNode>();

        public AnimationNode()
            : base()
        {
            InitializeComponent();
        }

        public AnimationNode(DiagramPanel container, string title)
            : base(container, Icons.film, title, Color.FromArgb(237, 210, 209), Color.FromArgb(103, 60, 66), Color.Black)
        {
            InitializeComponent();
            this.Paint += new PaintEventHandler(AnimationNode_Paint);
        }

        void AnimationNode_Paint(object sender, PaintEventArgs e)
        {
            SolidBrush b = new SolidBrush(this.ForeColor);
            e.Graphics.DrawString(string.Format("{0} input{1}", inputs.Count, inputs.Count == 1 ? "" : "s"),
                new Font("Arial", 10, FontStyle.Regular), b, 3, 30);
        }

        public override bool AddInput(Node input)
        {
            if (input.GetType() != typeof(ImageNode)) return false;
            inputs.Add((ImageNode)input);
            this.Invalidate();
            return true;
        }

        public override void ProcessInput()
        {
            // create animations from images here
        }
    }
}
